/*
* Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const { X2DBeta } = require("../../../../engine/graphics/X2DInterface");
const { Scr } = require("../../../../engine/XDefine");
const { XTools } = require("../../../../engine/XTools");
const { RosBase } = require("./RosBase");

class RosService extends RosBase {
    constructor(name) {
        super(name, "service");
    }
    onDraw(offx = 0, offy = 0, locked = false) {
        let x = this.x + offx;
        let y = this.y + offy;
        X2DBeta.fillRect(x, y, this.w, 16, 0xff303030);
        X2DBeta.drawText("service", 12, x + this.w / 2, y + 8, 1, 1, 0, -2, -2, 0xffff7f50);

        y += 16;
        X2DBeta.fillRect(x, y, this.w, 16, 0xff404040);
        X2DBeta.drawText(this.name, 12, x + 4, y + 8, 1, 1, 0, -1, -2, 0xffe0e0e0);

        if (locked) {
            this.btns = [this.btn_hide];
            this.btn_hide.move(this.x + this.w - this.btn_hide.width() - 1, this.y + 1).onDraw(offx, offy);
        }
    }
}

module.exports = { RosService };